package edu.whu.rose.clock.kps.algorithm.blinks.search2;

import edu.whu.rose.clock.kps.algorithm.blinks.index.BilevelIndexDB;

public abstract class Cursor2 implements Comparable<Cursor2> {

	protected int block;
	
	protected Object[] list;
	protected int pos;
	
	protected BilevelIndexDB bidb;
	
	public Cursor2(int block, BilevelIndexDB bidb) {
		pos = -1;
		this.block = block;
		this.bidb = bidb;
	}
	
	public int compareTo(Cursor2 x) {
		if (peek() > x.peek()) {
			return 1;
		}
		else if (peek() < x.peek()) {
			return -1;
		}
		else {
			return 0;
		}
	}
	
	public void next() {
		pos++;
	}

	public boolean empty() {
		if (pos > list.length - 2) {
			return true;
		}
		else {
			return false;
		}
	}

	public abstract double getDistance();
	
	public abstract int getNode();
	
	public abstract int getFirst();

	public abstract double peek();

	public int getBlock() {
		return block;
	}

	public Object[] getList() {
		return list;
	}
	
}
